package com.zzuli.xyd.util;

import java.util.List;

public class PageUtil<E> {
    //每页记录数,默认每页显示5条记录
    private int pageSize=5;
    //页面索引
    private int pageIndex;
    //总记录数
    private int total;
    //总页数
    private int pages;
    //数据
    private List<E> records;
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getPageIndex() {
        return pageIndex;
    }
    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }
    public int getTotal() {
        return total;
    }
    public void setTotal(int total) {
        this.total = total;
    }

    public int getPages() {
        if(this.total%pageSize>0) {
            pages = this.total/pageSize +1;
        }
        else {
            pages = this.total/pageSize;
        }
        return pages;
    }
    public List<E> getRecords() {
        return records;
    }

    public void setRecords(List<E> recordlist) {
        this.records = recordlist;
    }
}
